<template>
  <view class="page-container">
    <!-- 状态栏占位 -->
    <view class="status-bar" :style="{ height: statusBarHeight + 'px' }"></view>
    

    <!-- 顶部banner -->
    <view class="banner">
      <image 
        class="banner-img" 
        src="/static/images/feedback.jpg" 
        mode="aspectFill"
      ></image>
      <text class="banner-text">期待你的反馈</text>
      <text class="banner-sub">DEFINE YOUR GREAT ATTITUDE</text>
    </view>

    <!-- 常见问题列表 -->
    <view class="faq-section">
      <view class="section-header">
        <text class="section-title">常见问题</text>
        <text class="view-all" @tap="viewAllFAQ">全部</text>
      </view>
      
      <view class="faq-list">
        <view 
          class="faq-item" 
          v-for="(item, index) in faqList" 
          :key="index"
          @tap="goToFAQDetail(item)"
        >
          <text class="faq-text">{{ item.question }}</text>
          <text class="arrow">></text>
        </view>
      </view>
    </view>

    <!-- 提交反馈按钮 -->
    <view class="feedback-btn" @tap="submitFeedback">
      <text>我要留言</text>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      statusBarHeight: 20,
      faqList: [
        { id: 1, question: '如何调节文字字体大小？' },
        { id: 2, question: '如何注销账号？' },
        { id: 3, question: '如何更改用户名和密码？' },
        { id: 4, question: '如何注销账号？' }
      ]
    }
  },
  onLoad() {
    this.getStatusBarHeight()
  },
  methods: {
    getStatusBarHeight() {
      const systemInfo = uni.getSystemInfoSync()
      this.statusBarHeight = systemInfo.statusBarHeight
    },
    goBack() {
      uni.navigateBack()
    },
    viewAllFAQ() {
      uni.navigateTo({
        url: '/pages/help/faq-list'
      })
    },
    goToFAQDetail(item) {
      uni.navigateTo({
        url: `/pages/help/faq-detail?id=${item.id}`
      })
    },
    submitFeedback() {
      uni.navigateTo({
        url: '/pages/help/feedback'
      })
    }
  }
}
</script>

<style scoped>
.page-container {
  min-height: 100vh;
  background-color: #f5f5f5;
}
.left {
  padding: 20rpx;
}

.back-icon {
  font-size: 40rpx;
}

.title {
  font-size: 34rpx;
  font-weight: 500;
}

.right {
  display: flex;
  align-items: center;
}

.share-icon,
.more-icon {
  width: 44rpx;
  height: 44rpx;
  margin-left: 30rpx;
}

.banner {
  position: relative;
  width: 100%;
  height: 300rpx;
  margin-bottom: 20rpx;
}

.banner-img {
  width: 100%;
  height: 100%;
  border-radius: 20rpx;
}

.banner-text {
  position: absolute;
  left: 40rpx;
  bottom: 80rpx;
  color: #fff;
  font-size: 36rpx;
  font-weight: bold;
}

.banner-sub {
  position: absolute;
  left: 40rpx;
  bottom: 40rpx;
  color: rgba(255, 255, 255, 0.8);
  font-size: 24rpx;
}

.faq-section {
  background-color: #fff;
  padding: 30rpx;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30rpx;
}

.section-title {
  font-size: 32rpx;
  font-weight: bold;
}

.view-all {
  font-size: 28rpx;
  color: #999;
}

.faq-list {
  margin-bottom: 40rpx;
}

.faq-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30rpx 0;
  border-bottom: 1rpx solid #f5f5f5;
}

.faq-text {
  font-size: 28rpx;
  color: #333;
}

.arrow {
  font-size: 24rpx;
  color: #999;
}

.feedback-btn {
  position: fixed;
  bottom: 60rpx;
  left: 50%;
  transform: translateX(-50%);
  width: 240rpx;
  height: 80rpx;
  background-color: #8a2be2;
  color: #fff;
  border-radius: 40rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28rpx;
  box-shadow: 0 4rpx 16rpx rgba(138, 43, 226, 0.3);
}

.feedback-btn:active {
  opacity: 0.9;
}
</style>